package com.qf.eduadmin.controller;

import com.qf.eduadmin.pojo.vo.QfClassify;
import com.qf.eduadmin.pojo.resp.ResponseData;
import com.qf.eduadmin.service.QfClassifyService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (QfClassify)表控制层
 *
 * @author makejava
 * @since 2021-12-25 18:42:32
 */
@RestController
@RequestMapping("/qfClassify")
public class QfClassifyController {
    /**
     * 服务对象
     */
    @Resource
    private QfClassifyService qfClassifyService;
    @RequestMapping("/findAll")
    @RequiresAuthentication
    @RequiresPermissions(value = {"/qfClassify/findAll"})
    public ResponseData findAll(@RequestParam("page")Integer page,@RequestParam("limit")Integer limit){
        //System.out.println(page+"--"+limit);
        ResponseData responseData = qfClassifyService.queryAllByLimit(page,limit);
        return responseData;
    }



    @RequestMapping("/insertClassify")
    @RequiresAuthentication
    @RequiresPermissions(value = {"/qfClassify/insertClassify"})
    public ResponseData insertClassify(@RequestBody QfClassify qfClassify){
        //System.out.println(qfClassify);
        ResponseData responseData = qfClassifyService.insert(qfClassify);
        return responseData;
    }

    @RequestMapping("/deleteClassify")
    @RequiresAuthentication
    @RequiresPermissions(value = {"/qfClassify/deleteClassify"})
    public ResponseData deleteById(@RequestParam("id")Integer id){
        System.out.println(id);
        ResponseData responseData = qfClassifyService.deleteById(id);
        return responseData;
    }

    @RequestMapping("/findById")
    @RequiresAuthentication
    @RequiresPermissions(value = {"/qfClassify/findById"})
    public ResponseData findById(@RequestParam("id")Integer id){
        System.out.println(id);
        ResponseData responseData = qfClassifyService.queryById(id);
        return responseData;
    }

    @RequestMapping("/updateClassify")
    @RequiresAuthentication
    @RequiresPermissions(value = {"/qfClassify/updateClassify"})
    public ResponseData updateClassify(@RequestBody QfClassify qfClassify){
        //System.out.println(qfClassify);
        ResponseData responseData = qfClassifyService.update(qfClassify);
        return responseData;
    }

    @RequestMapping("/findAllClassify")
    @RequiresAuthentication
    @RequiresPermissions(value = {"/qfClassify/findAllClassify"})
    public ResponseData findAllClassify(){
        ResponseData responseData = qfClassifyService.findAllClassify();
        return responseData;
    }
}